home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
PCSSP.LZH
/
PC-SSP.ZIP
/
POLYOPS.ZIP
/
PECN.FOR
< prev
next >
Wrap
Text File
|
1985-11-29
|
3KB
|
97 lines
C
C ..................................................................
C
C SUBROUTINE PECN
C
C PURPOSE
C ECONOMIZE A POLYNOMIAL FOR SYMMETRIC RANGE
C
C USAGE
C CALL PECN (P,N,BOUND,EPS,TOL,WORK)
C
C DESCRIPTION OF PARAMETERS
C P - COEFFICIENT VECTOR OF GIVEN POLYNOMIAL
C ON RETURN P CONTAINS THE ECONOMIZED POLYNOMIAL
C N - DIMENSION OF COEFFICIENT VECTOR P
C ON RETURN N CONTAINS DIMENSION OF ECONOMIZED
C POLYNOMIAL
C BOUND - RIGHT HAND BOUNDARY OF RANGE
C EPS - INITIAL ERROR BOUND
C ON RETURN EPS CONTAINS AN ERROR BOUND FOR THE
C ECONOMIZED POLYNOMIAL
C TOL - TOLERANCE FOR ERROR
C FINAL VALUE OF EPS MUST BE LESS THAN TOL
C WORK - WORKING STORAGE OF DIMENSION N (STARTING VALUE
C OF N RATHER THAN FINAL VALUE)
C
C REMARKS
C THE OPERATION IS BYPASSED IN CASE OF N LESS THAN 1.
C IN CASE OF AN ARBITRARY INTERVAL (XL,XR) IT IS NECESSARY
C FIRST TO CALCULATE THE EXPANSION OF THE GIVEN POLYNOMIAL
C WITH ARGUMENT X IN POWERS OF T = (X-(XR-XL)/2).
C THIS IS ACCOMPLISHED THROUGH SUBROUTINE PCLD.
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C SUBROUTINE PECN TAKES AN (N-1)ST DEGREE POLYNOMIAL
C APPROXIMATION TO A FUNCTION F(X) VALID WITHIN A TOLERANCE
C EPS OVER THE INTERVAL (-BOUND,BOUND) AND REDUCES IT IF
C POSSIBLE TO A POLYNOMIAL OF LOWER DEGREE VALID WITHIN
C THE GIVEN TOLERANCE TOL.
C THE INITIAL COEFFICIENT VECTOR P IS REPLACED BY THE FINAL
C VECTOR. THE INITIAL ERROR BOUND EPS IS REPLACED BY A FINAL
C ERROR BOUND.
C N IS REPLACED BY THE DIMENSION OF THE REDUCED POLYNOMIAL.
C THE COEFFICIENT VECTOR OF THE N-TH CHEBYSHEV POLYNOMIAL
C IS CALCULATED FROM THE RECURSION FORMULA
C A(K-1)=-A(K+1)*K*L*L*(K-1)/((N+K-2)*(N-K+2))
C REFERENCE
C K. A. BRONS, ALGORITHM 38, TELESCOPE 2, CACM VOL. 4, 1961,
C NO. 3, PP. 151-152.
C
C ..................................................................
C
SUBROUTINE PECN(P,N,BOUND,EPS,TOL,WORK)
C
DIMENSION P(1),WORK(1)
FL=BOUND*BOUND
C
C TEST OF DIMENSION
C
1 IF(N-1)2,3,6
2 RETURN
3 IF(EPS+ABS(P(1))-TOL)4,4,5
4 N=0
EPS=EPS+ABS(P(1))
5 RETURN
C
C CALCULATE EXPANSION OF CHEBYSHEV POLYNOMIAL
C
6 NEND=N-2
WORK(N)=-P(N)
DO 7 J=1,NEND,2
K=N-J
FN=(NEND-1+K)*(NEND+3-K)
FK=K*(K-1)
7 WORK(K-1)=-WORK(K+1)*FK*FL/FN
C
C TEST FOR FEASIBILITY OF REDUCTION
C
IF(K-2)8,8,9
8 FN=ABS(WORK(1))
GOTO 10
9 FN=N-1
FN=ABS(WORK(2)/FN)
10 IF(EPS+FN-TOL)11,11,5
C
C REDUCE POLYNOMIAL
C
11 EPS=EPS+FN
N=N-1
DO 12 J=K,N,2
12 P(J-1)=P(J-1)+WORK(J-1)
GOTO 1
END